#pragma once


#include <string>
#include "..\Inc\ISocket.h"
#include "..\..\Lib_Base\inc\Timer.h"


namespace net
{
	class CSocket;
	class CClientSocket : public IClientSocket
	{
	public:
		CClientSocket(IClientSocketEvent& event);
		virtual ~CClientSocket();
		
		bool			Init			(const char* pszIP, int nPort, unsigned long dwReconnectInterval);
		
	// interface of IClientSocket
	public:
		unsigned long	Release			(void)		{ delete this; return 0; }

		bool			SendMsg			(const void* buf, int nSize);
		void			Process			(void);
		void			Close			(void);	
		
	protected:
		IClientSocketEvent&		m_eventSocket;
		CSocket*				m_pSocket;
		
		std::string				m_strIP;
		int						m_nPort;

		unsigned long			m_ulReconnectInterval;
		sbase::CTimerMS			m_tmAutoConnect;
	};
	
}

